import { Body, Controller, Post, Req } from '@nestjs/common';
import { ValidateDto } from './dto';
import { CaptchaService } from './captcha.service';
import { ResultData } from 'src/common/utils/result';
import { Request } from 'express';

@Controller('captcha')
export class CaptchaController {
  constructor(private readonly captchaService: CaptchaService) {}
  @Post('validate')
  async validate(@Body() validateDto: ValidateDto) {
    const result = await this.captchaService.validate(validateDto);
    return ResultData.ok({ valid: result }, result ? '验证成功' : '验证失败');
  }
}
